package com.rede.didiok.user.modulelist.rank.dao;

import java.util.List;
import java.util.Map;

import org.apache.ibatis.annotations.Mapper;
import org.apache.ibatis.annotations.Param;
import org.apache.ibatis.annotations.Select;

import com.baomidou.mybatisplus.core.mapper.BaseMapper;
import com.rede.didiok.user.modulelist.rank.entity.RankEntity;

/**
 * 榜单，榜单的主体信息,一个榜单对应一条记录，一个榜单包含多个 rank_rank_member 记录
 * 
 * @author Rede
 * @email didiok@foxmail.com
 * @date 2023-07-20 22:09:24
 */
@Mapper
public interface RankDao extends BaseMapper<RankEntity> {

    /**
     * 修改榜单的显示状态
     * @param rankUid
     * @param status
     */
    void updateDeleteStatusByUid(@Param("rankUid") String rankUid, @Param("status")  Integer status);

    /**
     * 获取每个榜单分类下的榜单数目
     *
     * @return
     */
    @Select("SELECT cat_uid, COUNT(cat_uid) AS count FROM  r_rank where status = 1 GROUP BY cat_uid")
    List<Map<String, Object>> getRankCountByCategory();


}
